home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / c_lang / tcwindow.lzh / WINDOW.006 < prev    next >
Encoding:
Text File  |  1987-12-06  |  32.9 KB  |  586 lines

  1. .H:
  2. .H:
  3. .H:                Charles G. Nemer                                                                      CIS 166
  4. .H:                WINDOW FUNCTIONS
  5. .H:
  6. .H:
  7. .N:34
  8. .F:                                                                      Page.$$$
  9.     
  10.  
  11.  
  12.                /*****************************************************************************/
  13.                /* This is to show you what you can do with windows                          */
  14.                /* written by Charles G. Nemer to demostrate windows functions writen by same*/
  15.                /*            4538 Westlake Dr.                                              */
  16.                /*            Garland TX. 75043                                              */
  17.                /*            214 226 9364                                                   */
  18.                /* ver 1 10-87                                                               */
  19.                /*****************************************************************************/
  20.  
  21.  
  22.                #define TRUE -1
  23.                #define FALSE 0
  24.  
  25.                char w_for_retrace;
  26.  
  27.                void intr(int,struct REGPACK*);
  28.                int int86(int,union REGS*,union REGS*);
  29.  
  30.                /* #include <stdarg.h>*/
  31.                #include <stdio.h>
  32.                #include <alloc.h>
  33.                #include <dos.h>
  34.                #include <ctype.h>
  35.                #include <conio.h>
  36.                #include <ctype.h>
  37.                #include <screen.h>
  38.                /* #include "windo1.c" */
  39.  
  40.                union REGS regs;
  41.  
  42.                unsigned short y,yes,rb=10,cb=20,re=20,ce=50,bd=1,bdc=0x70,size,z,x,
  43.                               not_done,cl=0x70,done,bdcx,clx,rb1,cb1,re1,ce1,wnumber,
  44.                               wc;
  45.  
  46.                char buffer[134],bdcolor,
  47.                     c,ch[20],buff1[5],buff2[5],buff3[5],buff4[5];
  48.  
  49.                char *test="abcdefghijklmnopqrstuvwxyz\0";
  50.  
  51.                struct time t_o;
  52.  
  53.                /*****************************************************************************/
  54.                /* function to check if ASCII passed is HEX and if it is make HEX integer    */
  55.                /* if it is not it returns 0                                                 */
  56.                /*****************************************************************************/
  57.  
  58.                int hex_int(int c)
  59.                  {
  60.                    if(isxdigit(c))                                        /* if HEX */
  61.                      {
  62.                       if(c>='0' && c<='9') return(c & 0x0f);              /* if 0-9 */
  63.                       if((c>='A' && c<='F')||(c>='a' && c<='f'))          /* if a-d or A-D */
  64.                         return((c & 0x0f)+0x09);
  65.                       }/* end of if*/
  66.                    return(0);                                             /* if not hex return 0*/
  67.                   }/* end of hex it*/
  68.  
  69.                /*****************************************************************************/
  70.                /* function wait for key pressed and check if yes or no it will wait untill  */
  71.                /* key press and y or n is entered                                           */
  72.                /*****************************************************************************/
  73.  
  74.                int answer_y_n()
  75.                   {
  76.                    int c;
  77.                    do
  78.                       {
  79.                        while(!kbhit());
  80.                        c=getch();
  81.                        c=toupper(c);
  82.                       }
  83.                     while((c!='Y')&&(c!='N'));
  84.                     return(c);
  85.                     }
  86.  
  87.                /*****************************************************************************/
  88.                /*                first demostration of the use of windows                   */
  89.                /* This demostration is to show you how to make a window and help you select */
  90.                /* the color and border. It also demostrates how to read and write to a      */
  91.                /* window.                                                                   */
  92.                /*****************************************************************************/
  93.  
  94.                void demo1()
  95.                 {
  96.                   extern unsigned short scanstart,scanstop;
  97.                   set_color(BBLACK|WHITE);                                /* set the color for wprintf()*/
  98.                   wnumber=window(0,0,15,79,2,(BBLACK|LIGHT|RED));         /* make window*/
  99.                   titlef(" DEMO of WINDOWS ",0x4b);
  100.                   set_color(BBLACK|WHITE);      wprintf("\n            This is a");
  101.                   set_color(BBLACK|LIGHT|BLUE); wprintf(" DEMOSTRATION");
  102.                   set_color(BBLACK|WHITE);      wprintf(" of what you can do with windows. \n");
  103.                   wprintf("                              Do you see snow Y/N : ");
  104.                   buff1[1]=0;
  105.                   window(13,35,17,50,10,0x70);
  106.                   titlef(" CLOCK ",0x70);
  107.                   cursoroff();                                            /* turn cursor off*/
  108.                   do
  109.                    {
  110.                     do                                                    /* write to screen and check for snow*/
  111.                      {
  112.                       set_snow(FALSE);                                    /* set for fast write*/
  113.                       wgoto(1,1);
  114.                       gettime(&t_o);                                      /* get time*/
  115.                       wprintf("%02d:%02d:%02d::%02d ",t_o.ti_hour,t_o.ti_min,t_o.ti_sec,t_o.ti_hund);
  116.                      /* wprintf(ch);                                         write formatted time to window*/
  117.                       }
  118.                    while(!kbhit());                                       /* check for key pressed*/
  119.                    buff1[0]=getch();                                      /* get input*/
  120.                    buff1[0]=toupper(buff1[0]);                            /* upper case input*/
  121.                    }                                                      /* check for Y or N */
  122.                   while((buff1[0]!='Y')&&(buff1[0]!='N'));
  123.                   delete_window(0);
  124.                   wgoto(2,52);
  125.                   cursoron();
  126.                   wprintf(buff1);
  127.                   if((buff1[0]=='Y')||(buff1[0]=='y')) {set_snow(TRUE);}
  128.                   wgoto(3,0);
  129.                   wprintf("                         Next is a demo of window(); \n");
  130.                   wprintf("                               Press any key :");while(!kbhit());getch();
  131.                   clrscr();
  132.                   wprintf(" This is a demo of window() \n");
  133.                   wprintf(" enter starting row :\n");
  134.                   wprintf(" enter starting column :\n");
  135.                   wprintf(" enter ending row :\n");
  136.                   wprintf(" enter ending column :\n");
  137.                   wprintf(" enter border type 0-13 :\n");
  138.                   wprintf(" enter border color in HEX background :     forground :    color=0x\n");
  139.                   wprintf(" enter window color in HEX background :     forground :    color=0x\n");
  140.                   wprintf(" are you done Y/N :\n");
  141.                   wgoto(1,22);printf("%d",rb);                            /* and print new */
  142.                   wgoto(2,25);printf("%d",cb);                            /* and print new */
  143.                   wgoto(3,20);printf("%d",re);                            /* and print new */
  144.                   wgoto(4,22);printf("%d",ce);                            /* and print new */
  145.                   wgoto(5,26);printf("%d",bd);                            /* and print new */
  146.                   wgoto(6,40);printf("%02X",(bdc&0xf0));                  /* and print new */
  147.                   wgoto(6,56);printf("%X",(bdc&0x0f));                    /* and print new */
  148.                   wgoto(6,67);printf("%02X",bdc);                         /* and print new color */
  149.                   wgoto(7,40);printf("%02X",(cl&0xf0));                   /* and print new */
  150.                   wgoto(7,56);printf("%X",(cl&0x0f));                     /* and print new */
  151.                   wgoto(7,67);printf("%02X",cl);                          /* and print new color */
  152.                   done=TRUE;
  153.                   set_color(cl);                                          /* set color*/
  154.                   wnumber=window(rb,cb,re,ce,bd,bdc);                     /* make window*/
  155.                   wprintf(" This is a demo of making a\n");
  156.                   wprintf(" window. Like to try ?\n");
  157.                   wprintf(" Enter Y/N :");
  158.                   if(answer_y_n()=='Y')                                   /* read kbd*/
  159.                     {
  160.                       delete_window(0);
  161.                       clrscr();                                           /* go to display*/
  162.                       while(done)
  163.                       {
  164.                       not_done=TRUE;
  165.                       while(not_done)
  166.                       {
  167.                          wgoto(0,0);
  168.                          titlef(" DEMO of WINDOWS ",0x4b);
  169.                          wprintf(" This is a demo ofwnumber=window() \n");
  170.                          wprintf(" enter starting row :\n");
  171.                          wprintf(" enter starting column :\n");
  172.                          wprintf(" enter ending row :\n");
  173.                          wprintf(" enter ending column :\n");
  174.                          wprintf(" enter border type 0-13 :\n");
  175.                          wprintf(" enter border color in HEX background :     forground :    color=0x\n");
  176.                          wprintf(" enter window color in HEX background :     forground :    color=0x\n");
  177.                          wprintf(" are you done Y/N :\n");
  178.                          wgoto(1,22);z=freadf(buff1,2);                   /* get starting row */
  179.                          if(z!=0)rb=atoi(buff1);if(rb<0)rb=0;if(rb>24)rb=24;  /* check range */
  180.                          wgoto(1,22);wprintf("   ");                       /* clear old */
  181.                          wgoto(1,22);printf("%d",rb);                     /* and print new */
  182.                          wgoto(2,25);z=freadf(buff1,2);                   /* get starting column */
  183.                          if(z!=0)cb=atoi(buff1);if(cb<0)cb=0;if(cb>79)cb=79;  /* if entered make int from char and check range */
  184.                          wgoto(2,25);wprintf("   ");                       /* clear old */
  185.                          wgoto(2,25);printf("%d",cb);                     /* and print new */
  186.                          wgoto(3,20);z=freadf(buff1,2);                   /* get ending row */
  187.                          if(z!=0)re=atoi(buff1);if(re<0)re=0;if(re>24)re=24;  /* if entered make int from char and check range */
  188.                          wgoto(3,20);wprintf("   ");                       /* clear old */
  189.                          wgoto(3,20);printf("%d",re);                     /* and print new */
  190.                          wgoto(4,23);z=freadf(buff1,2);                   /* get ending column */
  191.                          if(z!=0)ce=atoi(buff1);if(ce<0)ce=0;if(ce>79)ce=79;  /* if entered  make int from char and check range */
  192.                          wgoto(4,23);wprintf("   ");                       /* clear old */
  193.                          wgoto(4,23);printf("%d",ce);                     /* and print new */
  194.                          wgoto(5,26);z=freadf(buff1,2);                   /* get border type */
  195.                          if(z!=0)bd=atoi(buff1);                          /* if entered make int from char and check range */
  196.                             else                                          /* go to next border type */
  197.                                {
  198.                                 bd++;                                     /* next border type */
  199.                                 if(bd>13) bd=0;                           /* if on more go to first */
  200.                                 printf("%d",bd);                          /* print new border */
  201.                                 }
  202.                          if(bd<0)bd=0;if(bd>13)bd=13;                     /* if input is out of range make in range */
  203.                          wgoto(5,26);wprintf("   ");                       /* clear old */
  204.                          wgoto(5,26);printf("%d",bd);                     /* and print new */
  205.                          wgoto(6,40);z=freadf(buff1,1);                   /* get border background color */
  206.                          if(z!=0)                                         /* if new */
  207.                            {
  208.                             bdcx=bdc&0x0f;
  209.                             bdc=hex_int(buff1[0]);                        /* if entered make int out of char */
  210.                             bdc=bdc<<4|bdcx;                              /* put in left side of att */
  211.                             }
  212.                          wgoto(6,40);wprintf("   ");                       /* clear old */
  213.                          wgoto(6,40);printf("%02X",(bdc&0xf0));           /* and print new */
  214.                          wgoto(6,56);z=freadf(buff1,1);                   /* get border forgroung color */
  215.                          if(z!=0)                                         /* if new */
  216.                            {
  217.                             bdcx=bdc&0xf0;
  218.                             bdc=hex_int(buff1[0]);                        /* if entered make int out of char */
  219.                             bdc=bdc|bdcx;                                 /* put in left side of att */
  220.                             }
  221.                          wgoto(6,56);wprintf("   ");                       /* clear old */
  222.                          wgoto(6,56);printf("%X",(bdc&0x0f));             /* and print new */
  223.                          wgoto(6,67);printf("%02X",bdc);                  /* and print new color */
  224.                          wgoto(7,40);z=freadf(buff1,1);                   /* get background color */
  225.                          if(z!=0)                                         /* if new */
  226.                            {
  227.                             clx=cl&0x0f;
  228.                             cl=hex_int(buff1[0]);                         /* if entered make int out of char */
  229.                             cl=cl<<4|clx;                                 /* put in left side of att */
  230.  
  231.                             }
  232.                          wgoto(7,40);wprintf("   ");                       /* clear old */
  233.                          wgoto(7,40);printf("%02X",(cl&0xf0));            /* and print new */
  234.                          wgoto(7,56);z=freadf(buff1,1);                   /* get forgroung color */
  235.                          if(z!=0)                                         /* if new */
  236.                            {
  237.                             clx=cl&0xf0;
  238.                             cl=hex_int(buff1[0]);                         /* if entered make int out of char */
  239.                             cl=cl|clx;                                    /* put in left side of att */
  240.                             }
  241.                          wgoto(7,56);wprintf("   ");                       /* clear old */
  242.                          wgoto(7,56);printf("%X",(cl&0x0f));              /* and print new */
  243.                          wgoto(7,67);printf("%02X",cl);                   /* and print new color */
  244.                          wgoto(8,20);                                     /* check to is if done */
  245.                          if(answer_y_n()=='Y')
  246.  
  247.                            {
  248.                              delete_window(0);                            /* get rid of window*/
  249.                              not_done=FALSE;
  250.                             }
  251.  
  252.                     }
  253.  
  254.                      delete_window(0);                                    /* delete window on screen*/
  255.                      set_color(cl);                                       /* set color*/
  256.                      wnumber=window(rb,cb,re,ce,bd,bdc);                  /* make window*/
  257.                      readf(buffer);                                       /* read kbd*/
  258.                      set_color(0x70);
  259.                      wnumber=window(15,20,19,60,2,0x07);                  /* window for question*/
  260.                      wprintf(" Do another window Y/N :");                  /* another window?*/
  261.  
  262.                      if(answer_y_n()=='N')
  263.                        {
  264.                         delete_window(0);
  265.                         delete_window(0);
  266.                         done=FALSE;                                       /* if not stop*/
  267.                         }
  268.                      else
  269.                        {
  270.                         delete_window(0);
  271.                         set_color(BBLACK|WHITE);
  272.                         wnumber=window(0,0,15,79,2,(BBLACK|LIGHT|RED));
  273.                         }
  274.                    }
  275.                  }
  276.                  else
  277.                      {
  278.                       delete_window(0);
  279.                       delete_window(0);
  280.                       }
  281.                 }
  282.  
  283.  
  284.                /*****************************************************************************/
  285.                /*                    This is the second demostration of windows             */
  286.                /*  It demostrates the use of changing to another window and you can         */
  287.                /*  write to the window.                                                     */
  288.                /*****************************************************************************/
  289.                void demo2()
  290.                    {
  291.                      set_color(BBLACK|WHITE);
  292.                      wnumber=window(0,0,15,79,2,(BBLACK|LIGHT|RED));
  293.                      titlef(" A Demostration of WINDOWS ",0x4b);
  294.                      wprintf("\n\n\n\n            There is some other things that windows let you do.\n");
  295.                      set_color(BBLACK|0x03);
  296.                      wprintf("            You can change the color of a window any time you like.\n");
  297.                      set_color(BBLACK|LIGHT|0x07);wprintf("            Now ");
  298.                      set_color(BBLACK|LIGHT|0x06);wprintf("would ");
  299.                      set_color(BBLACK|LIGHT|0x05);wprintf("you ");
  300.                      set_color(BBLACK|LIGHT|0x04);wprintf("like ");
  301.                      set_color(BBLACK|LIGHT|0x03);wprintf("to ");
  302.                      set_color(BBLACK|LIGHT|0x02);wprintf("see ");
  303.                      set_color(BBLACK|LIGHT|0x01);wprintf("another ");
  304.                      set_color(BBLACK|0x07);wprintf("demo, ");
  305.                      set_color(BBLACK|0x06);wprintf("it's ");
  306.                      set_color(BBLACK|0x05);wprintf("a ");
  307.                      set_color(BBLACK|0x04);wprintf("demo\n");
  308.  
  309.                      set_color(BBLACK|WHITE);
  310.                      wprintf("            on deleteing a window, any window, you must just make \n");
  311.                      wprintf("            shure that no other window is on top of it.  Enter Y/N :");
  312.  
  313.                      if(answer_y_n()=='Y')
  314.                        {
  315.  
  316.                         set_color(BBLACK|LIGHT|RED);                      /* set the color of the window*/
  317.                         wnumber=window(0,0,10,25,1,0x0f);                 /* make the window*/
  318.                         sprintf(ch,"window %d",wnumber);                  /* change int to formatted string*/
  319.                         titlef(ch,0x7c);                                  /* title the window*/
  320.                         set_color(BRED|BLACK);                            /* set the color of the window*/
  321.                         wnumber=window(11,0,21,25,10,0x70);               /* make the window*/
  322.                         sprintf(ch,"window %d",wnumber);                  /* change int to formatted string*/
  323.                         titlef(ch,0x0F);                                  /* title the window*/
  324.                         set_color(BWHITE|BLACK);                          /* set the color of the window*/
  325.                         wnumber=window(0,27,10,45,8,0x0f);                /* make the window*/
  326.                         sprintf(ch,"window %d",wnumber);                  /* change int to formatted string*/
  327.                         titlef(ch,0x7b);                                  /* title the window*/
  328.                         set_color(BBLUE|LIGHT|RED);                       /* set the color of the window*/
  329.                         wnumber=window(11,27,21,45,3,0x70);               /* make the window*/
  330.                         sprintf(ch,"window %d",wnumber);                  /* change int to formatted string*/
  331.                         titlef(ch,0x79);                                  /* title the window*/
  332.                         wnumber=window(0,47,21,77,10,0x0f);               /* make the window*/
  333.                         sprintf(ch,"window %d",wnumber);                  /* change int to formatted string*/
  334.                         titlef(ch,0x0f);                                  /* title the window*/
  335.                         wprintf(" This demo is to show \n");
  336.                         wprintf(" how you can write into\n");
  337.                         wprintf(" any window.\n");
  338.                         wprintf(" Press any key to start");while(!kbhit());getch();
  339.                         for(z=1;z<=15;z++)                                /* write the test data to the windows*/
  340.                          {
  341.  
  342.                           set_color(BBLACK|RED);
  343.                           change_window(2);
  344.                           wprintf(test);
  345.                           change_window(5);
  346.                           wprintf(test);
  347.                           change_window(4);
  348.                           wprintf(test);
  349.                           change_window(3);
  350.                           wprintf(test);
  351.                           }
  352.                         change_window(6);
  353.                         clrscr();
  354.                         wprintf(" This demo is to show how\n");
  355.                         wprintf(" you can delete any window\n");
  356.                         wprintf(" in any order.\n");
  357.                         wprintf(" going to window 4\n");
  358.                         wprintf(" Press any key to start");while(!kbhit());getch();
  359.                         wc=(BWHITE|LIGHT|RED);
  360.                         change_window(4);
  361.                         clrscr();
  362.                         wprintf(" Press any key \n");
  363.                         wprintf("   to move to \n");
  364.                         wprintf(" window 2 and \n");
  365.                         wprintf("    delete \n");
  366.                         wprintf(" window 3 ");while(!kbhit());getch();
  367.                         delete_window(3);
  368.  
  369.                         change_window(2);
  370.                         clrscr();
  371.                         wprintf(" Press any key to\n");
  372.                         wprintf(" move to window 5\n");
  373.                         wprintf(" and delete \n");
  374.                         wprintf(" window 4");while(!kbhit());getch();
  375.                         delete_window(4);
  376.  
  377.                         change_window(5);
  378.                         clrscr();
  379.                         wprintf(" Press any key \n");
  380.                         wprintf("   to move to \n");
  381.                         wprintf(" window 6 and \n");
  382.                         wprintf("    delete \n");
  383.                         wprintf(" window 2 ");while(!kbhit());getch();
  384.                         delete_window(2);
  385.  
  386.                         change_window(6);
  387.                         clrscr();
  388.                         wprintf("\n Press any key to delete\n");
  389.                         wprintf(" window 5");while(!kbhit());getch();
  390.                         delete_window(5);
  391.  
  392.                       }
  393.                       for(z=num_of_w();z>=1;z--)                          /* delete all windows*/
  394.                          {delete_window(0);}
  395.                   }
  396.  
  397.  
  398.                /*****************************************************************************/
  399.                /*                    This is the third demostration of windows              */
  400.                /* This is to show you all of the borders ( remember that the colors used on */
  401.                /* a border will change it so try different combinations of colors)          */
  402.                /*****************************************************************************/
  403.  
  404.                void demo3()
  405.                    {
  406.                         set_color(BBLACK|WHITE);
  407.                         wnumber=window(0,40,15,70,2,(BBLACK|LIGHT|BLUE));
  408.                         titlef("\n Demostration of WINDOWS ",0x4b);
  409.                         wprintf(" You will see how you can \n");
  410.                         wprintf(" write into all windows and\n");
  411.                         wprintf(" see some of the window \n");
  412.                         wprintf(" borders you can create.\n");
  413.                         wprintf(" Like to try Y/N :");
  414.                         if(answer_y_n()=='Y')
  415.                           {
  416.                           rb=0;cb=0;re=5;ce=5;bd=0;
  417.                           for(y=1;y<=4;y++)                               /* make 16 windows*/
  418.                              {
  419.  
  420.                               for(x=1;x<=4;x++)
  421.                                  {
  422.                                   switch (x)
  423.                                        {
  424.                                         case 1:
  425.                                         case 3:
  426.                                                   set_color(0x07);
  427.                                                   bdc=0x70;
  428.                                                   wc=0x7f;
  429.                                                   break;
  430.                                         case 2:
  431.                                         case 4:
  432.                                                   set_color(0x70);
  433.                                                   bdc=0x07;
  434.                                                   wc=0x0f;
  435.                                                   break;
  436.                                         }
  437.                                   wnumber=window(rb,cb,re,ce,bd,bdc);
  438.                                   sprintf(ch,"%d",wnumber);
  439.                                   titlef(ch,wc);
  440.                                   cb+=9;ce+=9;
  441.                                   if(bd<=12)bd++;else bd=0;
  442.                                  }
  443.                                   rb+=6;re+=6;cb=0;ce=5;
  444.                              }
  445.  
  446.                          change_window(1);
  447.                          clrscr();
  448.                          wprintf(" Press any key for demo");
  449.                          while(!kbhit());getch();wprintf("\n");
  450.                          cursoroff();
  451.                          for(z=2;z<=17;z++)                               /* write into windows to do something*/
  452.                             {
  453.                              for(y=1;y<=10;y++)
  454.                                {
  455.  
  456.                                 switch(z)
  457.                                   {
  458.                                    case  2: change_window(2);wprintf(" this is a test  ");
  459.                                    case  7: change_window(3);wprintf(" this is a test  ");
  460.                                    case 12: change_window(4);wprintf(" this is a test  ");
  461.                                    case  3: change_window(5);wprintf(" this is a test  ");
  462.                                    case  8: change_window(6);wprintf(" this is a test  ");
  463.                                    case 13: change_window(7);wprintf(" this is a test  ");
  464.                                    case  4: change_window(8);wprintf(" this is a test  ");
  465.                                    case  9: change_window(9);wprintf(" this is a test  ");
  466.                                    case 14: change_window(10);wprintf(" this is a test  ");
  467.                                    case  5: change_window(11);wprintf(" this is a test  ");
  468.                                    case 10: change_window(12);wprintf(" this is a test  ");
  469.                                    case 15: change_window(13);wprintf(" this is a test  ");
  470.                                    case  6: change_window(14);wprintf(" this is a test  ");
  471.                                    case 11: change_window(15);wprintf(" this is a test  ");
  472.                                    case 16: change_window(16);wprintf(" this is a test  ");
  473.                                    case 17: change_window(17);wprintf(" this is a test  ");
  474.                                   }
  475.                                }
  476.                             }
  477.  
  478.                          cursoron();
  479.                          change_window(1);
  480.                          clrscr();
  481.                          wprintf("\n\n\n End of demo press any key :");
  482.                          while(!kbhit());getch();
  483.                        }
  484.                          for(z=num_of_w();z>=1;z--)
  485.                            {delete_window(0);}
  486.                   }
  487.  
  488.  
  489.  
  490.                /*****************************************************************************/
  491.                /*                  This is the ending demostration of windows               */
  492.                /*****************************************************************************/
  493.  
  494.                void ending()
  495.                {
  496.                        rb=7;cb=15;re=20;ce=70;
  497.                        rb1=(re-rb)/2+rb;
  498.                        cb1=(ce-cb)/2+cb;
  499.                        re1=rb1;ce1=cb1;
  500.                        while((rb1!=rb)||(cb1!=cb)||(re1!=re)||(ce1!=ce))
  501.                          {
  502.                          wnumber=window(rb1,cb1,re1,ce1,2,0x0f);
  503.                           if(rb1!=rb){rb1-=1;}
  504.                           if(cb1!=cb){cb1-=1;}
  505.                           if(re1!=re){re1+=1;}
  506.                           if(ce1!=ce){ce1+=1;}
  507.  
  508.                           }
  509.                        wnumber=window(rb1,cb1,re1,ce1,2,0x0f);
  510.                        wgoto(5,15);
  511.                        wprintf("  That all folks !!!!");
  512.                        wgoto(7,15);
  513.                        wprintf("     press any key :");
  514.                        while(!kbhit());getch();
  515.                        for(z=num_of_w();z>=1;z--)
  516.                         {delete_window(0);}
  517.                        set_color(BBLACK|WHITE);
  518.                        wnumber=window(8,5,12,75,10,(BBLACK|LIGHT|BLUE));
  519.                        titlef(" DEMO of WINDOWS ",0x4b);
  520.                        wprintf(" End of the demo, I hope you can use color windows in your programs.\n");
  521.                        wprintf(" Press any key :");while(!kbhit());getch();
  522.                 }
  523.  
  524.                void intro()
  525.                {
  526.                int w1,w2,w3,w4,w5,w6;
  527.  
  528.                 cursoroff();
  529.                 set_color(WHITE);
  530.                 w1=window(5,5,20,75,2,BBLACK|RED);
  531.                 set_color(BLACK);
  532.                 w2=window(8,15,17,65,4,BBLACK|WHITE);
  533.                 set_color(BBLACK|WHITE);
  534.                 w3=window(7,22,13,60,3,BBLACK|WHITE);
  535.                 titlef("COLOR WINDOWS",BBLACK|LIGHT|BLUE);
  536.                 w4=window(11,30,15,50,1,BBLACK|RED);
  537.                 set_color(BWHITE|BLACK);
  538.                 w5=window(15,40,22,65,2,BWHITE|BLACK);
  539.                 titlef("WINDOWS",BLINK|BWHITE|RED);
  540.                 w6=window(0,0,4,79,0,BWHITE|CYAN);
  541.                 change_window(w3);
  542.                 set_color(BBLACK|WHITE);
  543.                 wgoto(1,0);
  544.                 wprintf("        WINDOW UTILITY FOR\n");
  545.                 wprintf("        TURBO C AND OTHERS\n");
  546.                 change_window(w4);
  547.                 set_color(BBLACK|WHITE);
  548.                 wprintf("     Written in \n");
  549.                 wprintf("      Turbo C \n");
  550.                 change_window(w5);
  551.                 set_color(BWHITE|BLACK);
  552.                 wprintf("           by\n");
  553.                 wprintf("    Charles G. Nemer\n");
  554.                 wprintf("    4538 Westlake Dr.\n");
  555.                 wprintf("    Garland TX. 75043\n");
  556.                 wprintf("    214-226-9364\n");
  557.                 change_window(w6);
  558.                 set_color(BWHITE|BLACK);
  559.                 wprintf("     This window utility package is to show you how windows work. \n");
  560.                 wprintf("     All I ask if you use any of this work include my name and address. \n");
  561.                 wprintf("     If you think fitting that this work is any good send a donation up to $25. \n");
  562.                 wprintf("     press enter : ");
  563.                 cursoron();
  564.                 freadf(NULL,1);
  565.                 for(z=num_of_w();z>=1;z--)
  566.                         {delete_window(0);}
  567.                 }
  568.  
  569.                main()
  570.                {
  571.                      monitor();                                           /* check mode for screen writes*/
  572.                      intro();
  573.                      demo1();
  574.                      demo2();
  575.                      demo3();
  576.                      ending();
  577.  
  578.                      for(z=num_of_w();z>=1;z--)
  579.                         {delete_window(0);}
  580.                }
  581.  
  582.  
  583.  
  584.  
  585.                
  586.